<template>

  <div style="width: 700px;margin: 0 auto;background-color: #EEEEEE">


    <div v-for="moment in moments" :key="moment.id" >
      <!--头像-->
      <img src="../../assets/img/tx.jpg" alt="" style="width: 50px;height: 50px;display: block;float: left;border-radius: 50%;margin-right: 5px">
      <div v-html="moment.content" style=""></div>
    </div>
    <!--分页-->
    <el-pagination
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-size="pageSize"
      :total="totalCount"
      layout="pager"
      style="text-align: center"
      hide-on-single-page="true"
      background>
    </el-pagination>
  </div>


</template>

<script>
export default {
  name: "moment",
  data() {
    return {
      moments: [],
      pageIndex: 1,
      pageSize: 6,
      totalCount: 0,
      avatar:'../../assets/img/tx.jpg'
    }
  },
  methods: {
    getAllMoments() {
      this.$http({
        url: '/moment/list',
        params: {
          'page': this.pageIndex,
          'limit': this.pageSize,
        }
      }).then(({data}) => {
        if (data && data.code === 0) {
          this.moments = data.data.list;
          this.totalCount = data.data.totalCount;
        }
      })
    }
  },
  mounted() {
    this.getAllMoments();
  }
}
</script>

<style scoped>

</style>
